﻿using Domain.Model.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ValidBox4Mvc.ValidRules;

namespace Domain.Model
{
    /// <summary>
    /// 系统用户
    /// </summary>
    [Serializable]
    public class User : Entity
    {
        /// <summary>
        /// 账号
        /// </summary>
        [Required]
        [Length(30)]
        [Match(@"^\w+$", ErrorMessage = "只能为字母、数字或下划线")]
        //[Remote("/System/CheckAccount", "ID", "Account")]
        public string Account { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [Length(10, ErrorMessage = "姓名为1到10个字")]
        public string Name { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        [Required]
        [Length(10, ErrorMessage = "姓名为1到10个字")]
        public string NickName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [Required]
        [Length(6, 32, ErrorMessage = "密码不能过短或过长")]
        public string Password { get; set; }

        /// <summary>
        /// 交易密码
        /// </summary>
        [Required]
        [Length(6, 32, ErrorMessage = "交易密码不能过短或过长")]
        public string ExchangePassword { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Required]
        public Genders Gender { get; set; }

        /// <summary>
        /// 电话号码
        /// </summary>        
        [Length(15, ErrorMessage = "长度不能过长")]
        [Match(@"^\d{11,}$", ErrorMessage = "请输入正确的手机号码")]
        public string TelPhone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [Length(20, ErrorMessage = "邮箱不能过长")]
        [Email]
        public string Email { get; set; }

        /// <summary>
        /// QQ
        /// </summary>
        [Length(15)]
        [Match(@"^\d{5,}$", ErrorMessage = "请输入正确的QQ号")]
        public string QQ { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        [Length(50, ErrorMessage = "地址为1到50字内")]
        public string Address { get; set; }

        /// <summary>
        /// 位置
        /// </summary>
        public Position Position { get; set; }

        /// <summary>
        /// 星级
        /// </summary>
        [Required]
        public Levels Level { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [Required]
        public VerifyState VerifyState { get; set; }

        /// <summary>
        /// 游戏区域
        /// </summary>
        [Required]
        public GameAreas GameArea { get; set; }

        /// <summary>
        /// 投资金额
        /// </summary>
        [Required]
        [Range(0.00d, (double)int.MaxValue)]
        public decimal NvestmentAmount { get; set; }

        /// <summary>
        /// 最近登录时间 
        /// </summary>
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// 推荐人
        /// </summary>
        [Length(20)]
        [Remote("/User/CheckReferrer", "Referrer")]
        public string Referrer { get; set; }

        /// <summary>
        /// 推荐人Id
        /// </summary>
        public Guid ReferrerId { get; set; }

        /// <summary>
        /// 接点人
        /// </summary>
        [Length(20)]
        public string ContactPerson { get; set; }

        /// <summary>
        /// 市场
        /// </summary>
        [Length(50)]
        public string Market { get; set; }

        /// <summary>
        /// 角色ID
        /// </summary>
        [Required]
        public Guid RoleId { get; set; }

        /// <summary>
        /// 关联的角色
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public virtual Role Role { get; set; }

        //电子币	奖金币	游戏豆	游戏状态

        /// <summary>
        /// 电子币
        /// </summary>
        public decimal ElectronicToken { get; set; }
        /// <summary>
        /// 奖金币
        /// </summary>
        public decimal Bonus { get; set; }
        /// <summary>
        /// 游戏豆
        /// </summary>
        public decimal GameBean { get; set; }
        /// <summary>
        /// 游戏豆价值
        /// </summary>
        public decimal GameBeanValue { get; set; }
        /// <summary>
        /// 游戏状态
        /// </summary>
        public GameState GameState { get; set; }

        /// <summary>
        /// 报单币
        /// </summary>
        public decimal DeclarationToken { get; set; }
        /// <summary>
        /// 奖金币
        /// </summary>
        public decimal BonusToken { get; set; }
        /// <summary>
        /// 基金币
        /// </summary>
        public decimal FundToken { get; set; }

        /// <summary>
        /// 出局倍数
        /// </summary>
        public int OutMultiple { get; set; }

        /// <summary>
        /// 直推奖
        /// </summary>
        public decimal BounsPush { get; set; }

        /// <summary>
        /// 左区右区
        /// </summary>
        //public Around Around { get; set; }
    }
}
